<?php include('fns_db_forum.php'); ?>
<?php include('../views/layouts/_header.php'); ?>
<?php include('../views/layouts/_left.php'); ?>
<?php if(!checkIfAdmin()){
		header("location: forum.php");
	} ?>

<?php
if (isset($_GET['target']))
{
	$target = $_GET['target'];
	if ($target == '')
	{
		unset($target);
	}
}

if (isset($_GET['id']))
{
	$id = $_GET['id'];
	if ($id == '')
	{
		unset($id);
	}
}

switch ($target){
	case 'forum':
		delete_forum($id);
		echo 'Forum successfully deleted!';
		break;

	case 'topic':
		delete_topic($id);
		echo 'Topic successfully deleted!';
		break;

	case 'thread':
		delete_thread($id);
		echo 'Thread successfully deleted!';
		break;

	case 'post':
		delete_post($id);
		echo 'Post successfully deleted!';
		break;


	default:
		echo "<p>Unexpected parameter passed!</p>";
}
?>

<?php include('../views/layouts/_footer.php'); ?>
